package org.framework.edge.builder.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.framework.edge.builder.application.DockerBuildModuleRecordApplication;
import org.framework.edge.builder.application.command.docker.build.module.record.*;
import org.framework.edge.builder.application.dto.DockerBuildModuleRecordDTO;
import org.framework.edge.builder.domain.model.docker.builder.module.record.DockerBuildModuleRecord;
import org.springframework.web.bind.annotation.*;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.spring.EasyController;

import java.util.List;
/**
 * describe 打包记录 
 *
 * @author Jia wei Wu
 * @date 2024/08/13 07:39 晚上
 * @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController 
 **/
@Tag(name = "打包记录提供者")
@EasyController("/docker/build/module/record")
public class DockerBuildModuleRecordProvider  {

    @Resource
    private DockerBuildModuleRecordApplication dockerBuildModuleRecordApplication;

    /**
     * describe 新增打包记录
     *
     * @param dockerBuildModuleRecordStoryCommand 新增打包记录     
     * @return {@link Result<DockerBuildModuleRecord>} 打包记录新增后领域对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "新增打包记录")
    @PostMapping("/story")
    public Result<DockerBuildModuleRecord> story(@RequestBody DockerBuildModuleRecordStoryCommand dockerBuildModuleRecordStoryCommand){
        return dockerBuildModuleRecordApplication.story(dockerBuildModuleRecordStoryCommand);
    }
    /**
     * describe 批量新增打包记录
     *
     * @param dockerBuildModuleRecordStoryCommandList 批量新增打包记录     
     * @return {@link Result<List<DockerBuildModuleRecord>>} 打包记录新增后领域对象集合     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "批量新增打包记录")
    @PostMapping("/batchStory")
    public Result<List<DockerBuildModuleRecord>> batchStory(@RequestBody List<DockerBuildModuleRecordStoryCommand> dockerBuildModuleRecordStoryCommandList){
        return dockerBuildModuleRecordApplication.batchStory(dockerBuildModuleRecordStoryCommandList);
    }
    /**
     * describe 更新打包记录
     *
     * @param dockerBuildModuleRecordUpdateCommand 更新打包记录     
     * @return {@link Result<DockerBuildModuleRecord>} 打包记录领域对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "更新打包记录")
    @PutMapping("/updateOne")
    public Result<DockerBuildModuleRecord> updateOne(@RequestBody DockerBuildModuleRecordUpdateCommand dockerBuildModuleRecordUpdateCommand){
        return dockerBuildModuleRecordApplication.updateOne(dockerBuildModuleRecordUpdateCommand);
    }
    /**
     * describe 查询单个打包记录
     *
     * @param dockerBuildModuleRecordQueryOneCommand 查询单个打包记录     
     * @return {@link Result<DockerBuildModuleRecordDTO>} 打包记录DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "查询单个打包记录")
    @GetMapping("/findOne")
    public Result<DockerBuildModuleRecordDTO> findOne(@ModelAttribute DockerBuildModuleRecordQueryOneCommand dockerBuildModuleRecordQueryOneCommand){
        return dockerBuildModuleRecordApplication.findOne(dockerBuildModuleRecordQueryOneCommand);
    }
    /**
     * describe 查询多个打包记录
     *
     * @param dockerBuildModuleRecordQueryListCommand 查询多个打包记录     
     * @return {@link Result<List<DockerBuildModuleRecordDTO>>} 打包记录DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "查询多个打包记录")
    @GetMapping("/findList")
    public Result<List<DockerBuildModuleRecordDTO>> findList(@ModelAttribute DockerBuildModuleRecordQueryListCommand dockerBuildModuleRecordQueryListCommand){
        return dockerBuildModuleRecordApplication.findList(dockerBuildModuleRecordQueryListCommand);
    }
    /**
     * describe 分页查询多个打包记录
     *
     * @param dockerBuildModuleRecordQueryListCommand 分页查询多个打包记录     
     * @return {@link Result<LazyPage<DockerBuildModuleRecordDTO>>} 分页打包记录DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "分页查询多个打包记录")
    @GetMapping("/findPage")
    public Result<LazyPage<DockerBuildModuleRecordDTO>> findPage(@Parameter(description ="分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
                           @Parameter(description ="当前页数") @RequestParam(defaultValue = "1", value = "current") int current,@ModelAttribute DockerBuildModuleRecordQueryListCommand dockerBuildModuleRecordQueryListCommand){
        return dockerBuildModuleRecordApplication.findPage(size,current,dockerBuildModuleRecordQueryListCommand);
    }
    /**
     * describe 删除打包记录
     *
     * @param dockerBuildModuleRecordRemoveCommand 删除打包记录     
     * @return {@link Result<DockerBuildModuleRecord>} 打包记录     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "删除打包记录")
    @DeleteMapping("/remove")
    public Result<DockerBuildModuleRecord> remove(@ModelAttribute DockerBuildModuleRecordRemoveCommand dockerBuildModuleRecordRemoveCommand){
        return dockerBuildModuleRecordApplication.remove(dockerBuildModuleRecordRemoveCommand);
    }
}